README File for:

"Income, Education, and Policy Priorities"

Political Science Research and Methods

Chris Tausanovitch, University of California, Los Angeles (ORCID: 0000-0003-3401-3427)
Derek E. Holliday, Stanford University (ORCID: 0000-0002-0064-4979)

October 7, 2024

___________________________

Instructions:

1. Download files in the original zip format to preserve file structure.
2. Create an R project in the main directory (housing 00_master.R)
3. If necessary, install the librarian package (for package management)
4. Do one of the following:
	4a. If replicating the entire analysis, run the entirety of 00_master.R. This will take several hours.
	4b. If only replicating figures using intermediary data, skip the "Generate Plot Data" step (running gen_plotdata.R) and run the rest of the analysis.
5. A log of all replication outputs is given in replication_log.txt 

WARNING: The analysis for this paper is computationally intensive, loading and manipulating a dataframe with almost 10 million observations of almost 200 variables. This will take several hours on even well-equipped systems. We recommend users use the provided intermediary data created by gen_plotdata.R for purposes of figure replication, or, if interested, to run the analysis code individually for analyses of interest. We also suggest only attempting to run gen_plotdata.R on systems with at least 32 GB of RAM.

___________________________

List of replication files (alphabetical order):

- 00_master.R: Master replication file, runs all code necessary to replicate all findings in the paper
- README.txt: This file
- replication_log.txt: Log of outputs from replication process
- code:
	- conjoint_functions.R:             Helper functions for analysis
	- gen_agr_mods.R:                   Generate tables S10-S12
	- gen_appendix_tabs.R:              Generate tables S2-S7
	- gen_descriptives.R:               Generate descriptive statistics about dataset
	- gen_fig_altdemos.R:               Generate figures S6-S8
	- gen_fig_conjoint-unconditional.R: Generate figure 2
	- gen_fig_edu-agree-points.R:       Generate figure 6
	- gen_fig_edu-agree-scatter.R:      Generate figure 7
	- gen_fig_edu-republican-scatter.R: Generate figure 8
	- gen_fig_inc-agree-points.R:       Generate figure 4
	- gen_fig_inc-agree-scatter.R:      Generate figure 5
	- gen_fig_inc-edu.R:                Generate figure 3
	- gen_fig_range.R:                  Generate figure S9
	- gen_fig_s1.R:                     Generate figure S1       
	- gen_fig_s2.R:                     Generate figure S2 
	- gen_fig_s3.R:                     Generate figure S3 
	- gen_fig_s4.R:                     Generate figure S4 
	- gen_fig_s5.R:                     Generate figure S5
	- gen_fig_svyagree.R:               Generate figure S10
	- gen_plotdata.R:                   Runs all conjoint and auxiliary models, producing results outputs used by gen_fig scripts
	- gen_tab_cor.R:                    Generate table 1 and S9
	- gen_tab_deming.R:                 Generate table S8
	- gen_tab_econ.R:                   Generate table 2      
- data:
	- agree_diffs.rds:             Raw differences in group preferences
	- dta_final.parquet:           Full individual-conjoint-profile level data
	- dta_grp_int.parquet:         Intermediary recoding of dta_final.parquet used to generate differences in means
	- effects_ot.rds:              Monthly effects
	- fig_pid_agree_dat.rds:       Revealed preferences (agreement) by PID
	- fig_pid_disagree_dat.rds:    Revealed preferences (disagreement) by PID
	- fig_race_agree_dat.rds:      Revealed preferences (agreement) by race
	- fig_race_disagree_dat.rds:   Revealed preferences (disagreement) by race
	- fig_sex_agree_dat.rds:       Revealed preferences (agreement) by sex
	- fig_sex_disagree_dat.rds:    Revealed preferences (disagreement) by sex
	- fig2_dat.rds:                Unconditional AMCE (for figure 2)
	- fig3_edu_dat.rds:            AMCE by education groups (for figure 3)
	- fig3_inc_dat.rds:            AMCE by income groups (for figure 3)
	- fig3_inc2_dat.rds:           AMCE by income groups (using very high income)
	- fig4_inc_agree_dat.rds:      Revealed preferences by income group (agreement)
	- fig4_inc_disagree_dat.rds:   Revealed preferences by income group (disagreement)
	- fig4_inc_disagree2_dat.rds:  Revealed preferences by alternative income split (disagreement)
	- fig4_inc2_agree_dat.rds:     Revealed preferences by alternative income split (disagreement)
	- fig4a_inc_agree_dat.rds:     Revealed preferences by education holding income at low (agreement)
	- fig4a_inc_disagree_dat.rds:  Revealed preferences by education holding income at low (disagreement)
	- fig6_edu_agree_dat.rds:      Revealed preferences by education group (agreement)
	- fig6_edu_disagree_dat.rds:   Revealed preferences by education group (disagreement)
	- fig8_r_edu_agree_dat.rds:    Republican revealed preferences by education group (agreement)
	- fig8_r_edu_disagree_dat.rds: Republican revealed preferences by education group (disagreement)
	- policies.rds:                Information on policy items
	- policy_list.rds:             Vector of policy items
- figures:
	- figure_2.png: Figure 2
	- figure_3.png: Figure 3
	- figure_4.png: Figure 4
	- figure_5.png: Figure 5
	- figure_6.png: Figure 6
	- figure_7.png: Figure 7
	- figure_8.png: Figure 8
	- appendix:
		- figure_s1.png:  Figure S1
		- figure_s2.png:  Figure S2
		- figure_s3.png:  Figure S3
		- figure_s4.png:  Figure S4
		- figure_s5.png:  Figure S5
		- figure_s6.png:  Figure S6
		- figure_s7.png:  Figure S7
		- figure_s8.png:  Figure S8
		- figure_s9.png:  Figure S9
		- figure_s10.png: Figure S10
- tables:
	- tab_1.tex: Table 1
	- tab_2.tex: Table 2
	- appendix:
		- tab_s2.tex:  Table S2
		- tab_s3.tex:  Table S3
		- tab_s4.tex:  Table S4
		- tab_s5.tex:  Table S5
		- tab_s6.tex:  Table S6
		- tab_s7.tex:  Table S7
		- tab_s8.tex:  Table S8
		- tab_s9.tex:  Table S9
		- tab_s10.tex: Table S10
		- tab_s11.tex: Table S11
		- tab_s12.tex: Table S12
___________________________

Note 1: The replication was done with RStudio version 2023.06.0 Build 421, and with the R version 4.2.2.

Note 2: The replication was conducted on Windows 11 Pro 64-bit. Intel Core i7-10750H CPU @ 2.6GHz (12 CPUs). 32768 MB RAM.

Note 3: The R package versions for this replication are as follows:

kableExtra_1.4.0 
arrow_13.0.0.1   
patchwork_1.2.0  
rio_0.5.29       
here_1.0.1       
lfe_2.9-0        
Matrix_1.5-1    
lubridate_1.9.2  
forcats_1.0.0    
stringr_1.5.0    
dplyr_1.1.2      
purrr_1.0.1      
readr_2.1.4      
tidyr_1.3.0     
tibble_3.2.1     
ggplot2_3.5.1    
tidyverse_2.0.0 